package org.zxp.tools;

import com.xiaoleilu.hutool.date.DateUtil;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class PrintMysqlPatition {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = sf.parse("2021-12-21");
        Date end = sf.parse("2022-12-31");
        while(end.getTime() > parse.getTime()){
            SimpleDateFormat sf2 = new SimpleDateFormat("yyyyMMdd");
            Calendar c = Calendar.getInstance();
            c.setTime(parse);
            c.add(Calendar.DAY_OF_MONTH, 10);
            String format1 = sf.format(c.getTime());//yyyy-MM-dd
            String format2 = sf2.format(c.getTime());//yyyy-MM-dd
            String s = "PARTITION p"+format2+" VALUES LESS THAN (to_days('"+format1+"')) (\n" +
                    "            SUBPARTITION s"+format2+"01,\n" +
                    "            SUBPARTITION s"+format2+"02,\n" +
                    "            SUBPARTITION s"+format2+"03,\n" +
                    "            SUBPARTITION s"+format2+"04,\n" +
                    "            SUBPARTITION s"+format2+"05,\n" +
                    "            SUBPARTITION s"+format2+"06,\n" +
                    "            SUBPARTITION s"+format2+"07,\n" +
                    "            SUBPARTITION s"+format2+"08,\n" +
                    "            SUBPARTITION s"+format2+"09\n" +
                    "    ),";
            System.out.println(s);
            parse = c.getTime();



            String ss = "[{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":2147483647,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"ua_id\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"E3ZE5LTCKMUjXzYTAAAAAFbePnSYhfnFi6wFzQ9wG24=\"},{\"domain\":\"mp.weixin.qq.com\",\"hostOnly\":true,\"httpOnly\":true,\"name\":\"uuid\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":true,\"storeId\":\"0\",\"value\":\"9b4e0c44d78fb1e9b60260a75de353bc\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":1640584947,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"rand_info\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"CAESINShrs91SWSQZ6F3cCpllqlUEu4W+bhDK9CL7gMq4nyw\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":1640584947,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"slave_bizuin\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"3286148522\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":1640584947,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"data_bizuin\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"3286148522\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":1640584947,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"bizuin\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"3286148522\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":1640584947,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"data_ticket\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"e0c5brHrZKhDrh77Ohke9hIDMBXm1suePfEifNrWFdXIpPWn0gF1FFZKsubaR8WW\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":1640584947,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"slave_sid\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"SDdJTDhYbDE3Q2JTVFFfWnJ6eTRLQVBQWEticV91RUxVTUs3OVp0SERjanRKb1lDOGJnNWU3THZ5R3VRbnV3MjE1anlseG84RGNLWW1rSWZFQmhjMnZ5Q3hyY1B4QXg0aURkQ3BaVndPQXZLZjZscmtidEZKeXFjUEplSFR5bkpsZTVkcXlpNjExaUMyRTRB\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":1640584947,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"slave_user\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"gh_4a097c32896a\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":2147483647,\"hostOnly\":true,\"httpOnly\":true,\"name\":\"xid\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"6db6b660e691d38a34b8d719a08ae623\"},{\"domain\":\"mp.weixin.qq.com\",\"expirationDate\":4294967295,\"hostOnly\":true,\"httpOnly\":false,\"name\":\"mm_lang\",\"path\":\"/\",\"sameSite\":\"unspecified\",\"secure\":true,\"session\":false,\"storeId\":\"0\",\"value\":\"zh_CN\"}]";

        }

    }
}
